sub getDOY 
{
  my $date = $_[0];
  my $year = substr($date,0,4);
  my $mon  = substr($date,5,2);
  my $day  = substr($date,8,2);
  my $time = $_[1];
  my $hour = substr($time,0,2);
  my $mins = substr($time,3,2);
  $leap = int (1 - (($year - int(($year)/4) * 4) / 4)) ;

  if ($mon == 1)
  {
    $doy = $day;
  }
  elsif ($mon == 2)
  {
    $doy = 31+$day;
  }
  elsif ($mon == 3)
  {
    $doy = 59+$leap+$day;
  }
  elsif ($mon == 4)
  {
    $doy = 90+$leap+$day;
  }
  elsif ($mon == 5)
  {
    $doy = 120+$leap+$day;
  }
  elsif ($mon == 6)
  {
    $doy = 151+$leap+$day;
  }
  elsif ($mon == 7)
  {
    $doy = 181+$leap+$day;
  }
  elsif ($mon == 8)
  { 
    $doy = 212+$leap+$day;
  }
  elsif ($mon == 9)
  {
    $doy = 243+$leap+$day;
  }
  elsif ($mon == 10)
  {
    $doy = 273+$leap+$day;
  }
  elsif ($mon == 11)
  {
    $doy = 304+$leap+$day;
  }
  elsif ($mon == 12)
  {
    $doy = 334+$leap+$day;
  }

  $doy += (($mins / 60) + $hour) / 24;
  return $doy;
  print $doy;
}
1;
